//第一步注册图片资源到pubspec.yaml

import 'package:flutter/material.dart';
import 'package:flutter_app_demo/ui_demo/ui3dcard/MyCardFlipper.dart';
import 'package:flutter_app_demo/ui_demo/ui3dcard/bottom_indecator.dart';
import 'package:flutter_app_demo/podo/card_model.dart';

class UI3dCardPage extends MaterialPageRoute<UI3dCard> {
    UI3dCardPage()
        : super(builder: (BuildContext ctx) {
        return UI3dCard();
    });
}

class UI3dCard extends StatefulWidget {
    @override
    _UI3dCardState createState() => _UI3dCardState();
}

class _UI3dCardState extends State<UI3dCard> {
    
    double scrollPercent = 0.0;
    
    @override
    Widget build(BuildContext context) {
        return Scaffold(
            backgroundColor: Colors.black,
            body: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                    Container(
                        width: double.infinity,
                        height: 20.0,
                    ),
                    Expanded(
                        child: MyCardFlipper(
                            cards: cardsData,
                            onScroll: (double scrollPercent) {
                                setState(() {
                                    this.scrollPercent = scrollPercent;
                                });
                            }
                        ),
                    ),
                    
                    BottomBar(
                        cardCount: cardsData.length,
                        scrollPercent: scrollPercent,
                    ),
                
                ],
            ),
        );
    }
}
